<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	<button id="btn1">存储 cookie</button>
	<button id="btn2">读取 cookie</button>
</body>
<script>
	var btn1 = document.getElementById( 'btn1' );
	var btn2 = document.getElementById( 'btn2' );


	btn1.onclick = function () {
		// 存储 cookie
		document.cookie = 'name=jim; domain=bxg.com';
	};

	btn2.onclick = function () {
		console.log( document.cookie );
	};
</script>
</html>